package com.inmarry.form;

import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;

public final class HelloForm extends ActionForm {

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) throws Exception {

        this.userName = new String(userName.getBytes("ISO-8859-1"), "UTF-8");
    }

    public void reset(ActionMapping mapping,
            HttpServletRequest req) {
        this.userName = null;
    }

    public ActionErrors validate(
            ActionMapping mapping,
            HttpServletRequest req) {

        ActionErrors errors = new ActionErrors();
        
        if (( userName == null ) || (userName.length() < 1 ) ) {
            errors.add("username", new ActionMessage("hello.no.username.error"));
        }

        System.err.println(errors);
        return errors;
    }



    private String userName;

}

